//logs.js
const util = require('../../utils/util.js')

Page({
  data: {
    logs: [],
    datas:''
  },
  onLoad: function () {
    let that = this;
    this.setData({
      logs: (wx.getStorageSync('logs') || []).map(log => {
        return util.formatTime(new Date(log))
      })
    })
    wx.request({
      url: 'http://api.budejie.com/api/api_open.php?a=list&c=data&type=1',
      data: {},
      method: 'GET',
      header: "application/json", // 设置请求的 header
      success: function(res){
        console.log(res);
        //通过修改绑定的数组来改变页面
        that.setData({
          datas: res.data.list
        });
      },
      fail: function () {
        // fail
      },
      complete: function () {
        // complete
      }
    })
  }
})
